package com.czy.feign.controller;

import com.czy.feign.cilent.MovieClient;
import com.czy.feign.cilent.MovieClientFactory;
import com.czy.feign.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author czy
 * @create 2018-04-15 22:30
 **/
@RestController
public class FeignController
{
	@Autowired
	private MovieClient movieClient;

	@Autowired
	private MovieClientFactory movieClientFactory;

	@GetMapping("/{id}")
	public User findById(@PathVariable Integer id)
	{
		return movieClient.findUserById(id);
	}

	@GetMapping("/all")
	public List<User> findAll()
	{
		return movieClientFactory.findUserAll();
	}
}
